package com.ruoyi.column.service.impl;

import java.util.List;

import com.ruoyi.common.constant.SysConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.column.mapper.SysColumnTeacherMapper;
import com.ruoyi.column.domain.SysColumnTeacher;
import com.ruoyi.column.service.ISysColumnTeacherService;

/**
 * 专栏讲师Service业务层处理
 * 
 * @author yjf
 */
@Service
public class SysColumnTeacherServiceImpl implements ISysColumnTeacherService 
{
    @Autowired
    private SysColumnTeacherMapper sysColumnTeacherMapper;

    /**
     * 查询专栏讲师
     * 
     * @param id 专栏讲师主键
     * @return 专栏讲师
     */
    @Override
    public SysColumnTeacher selectSysColumnTeacherById(Long id)
    {
        return sysColumnTeacherMapper.selectSysColumnTeacherById(id);
    }

    /**
     * 查询专栏讲师列表
     * 
     * @param sysColumnTeacher 专栏讲师
     * @return 专栏讲师
     */
    @Override
    public List<SysColumnTeacher> selectSysColumnTeacherList(SysColumnTeacher sysColumnTeacher)
    {

        if(StringUtils.isNull(sysColumnTeacher.getDelFlag())){
            sysColumnTeacher.setDelFlag(SysConstants.CONSTANT_STR0);
        }
        return sysColumnTeacherMapper.selectSysColumnTeacherList(sysColumnTeacher);
    }

    /**
     * 新增专栏讲师
     * 
     * @param sysColumnTeacher 专栏讲师
     * @return 结果
     */
    @Override
    public int insertSysColumnTeacher(SysColumnTeacher sysColumnTeacher)
    {
        sysColumnTeacher.setCreateTime(DateUtils.getNowDate());
        sysColumnTeacher.setUpdateTime(DateUtils.getNowDate());
        return sysColumnTeacherMapper.insertSysColumnTeacher(sysColumnTeacher);
    }

    /**
     * 修改专栏讲师
     * 
     * @param sysColumnTeacher 专栏讲师
     * @return 结果
     */
    @Override
    public int updateSysColumnTeacher(SysColumnTeacher sysColumnTeacher)
    {
        sysColumnTeacher.setUpdateTime(DateUtils.getNowDate());
        return sysColumnTeacherMapper.updateSysColumnTeacher(sysColumnTeacher);
    }

    /**
     * 批量删除专栏讲师
     * 
     * @param ids 需要删除的专栏讲师主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnTeacherByIds(Long[] ids)
    {
        return sysColumnTeacherMapper.deleteSysColumnTeacherByIds(ids);
    }

    /**
     * 删除专栏讲师信息
     * 
     * @param id 专栏讲师主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnTeacherById(Long id)
    {
        return sysColumnTeacherMapper.deleteSysColumnTeacherById(id);
    }
}
